/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sw1_parcial1;

import java.io.File;
import net.sourceforge.tess4j.*;




/**
 *
 * @author DaViD
 */
public class SW1_Parcial1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here

        File imageFile = new File("images/test.png");
//        BufferedImage bi = new BufferedImage();
        Tesseract instance = Tesseract.getInstance(); //
//       
        
//        instance.setLanguage("esp");
        if (imageFile.exists()) {
            System.out.println("Nombre del archivo " + imageFile.getName());
            System.out.println("Camino             " + imageFile.getPath());
            System.out.println("Camino absoluto    " + imageFile.getAbsolutePath());
            System.out.println("Se puede escribir  " + imageFile.canRead());
            System.out.println("Se puede leer      " + imageFile.canWrite());
            System.out.println("Tamaño             " + imageFile.length());
            //"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"
            try {

                String result = instance.doOCR(imageFile);
                System.out.println(result);

            } catch (TesseractException e) {
                System.err.println(e.getMessage());
            }
        }

    }

}
